<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>自定义表单</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" type="text/css" href="assets/layui/css/layui.css" media="all" />
		<style>
			.layui-table[lay-size=lg] td{
				padding:10px;
			}
			.layui-textarea{
				min-height: 38px;
			}
		</style>
	</head
	<body class="edit-form">
		<span class="layui-breadcrumb">
		    <a>询残系统</a>
			<a><cite>编辑表单页面</cite></a>
		</span>
		<div class="layui-fluid">
			<div class="layui-form">
			<button class="layui-btn" id="edit-newline">增加字段</button>
			<table id="form-table" class="layui-table">
				<thead>
					<tr>
						<th>表单名称</th>
						<th>字段</th>
						<th>类型</th>
						<th>初始化数据，组合请使用“，”分隔</th>
						<th>参数1参数2，使用$分开</th>
						<th>权重</th>
						<th>是否列表显现</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<!--<tr>
						<td><input type="text" class="layui-input"/></td>
						<td><input type="text" class="layui-input"/></td>
						<td>
							<select name="" lay-filter="">
								<option value="">请选择</option>
								<option value="0">单选框</option>
								<option value="1">文本</option>
								<option value="2">下拉框</option>
							</select>
						</td>
						<td>
						    <textarea placeholder="请输入内容" class="layui-textarea"></textarea>
						</td>
						<td><input type="text" class="layui-input"/></td>
						<td><input type="text" class="layui-input"/></td>
						<td>
							<div class="layui-input-inline">
						      <input type="radio" name="yes" value="是" title="是" checked="">
						      <input type="radio" name="yes" value="否" title="否">
						    </div>
						</td>
						<td>
							<a class="layui-btn layui-btn-danger layui-btn-xs del-btn">删除</a>
						</td>
					</tr>-->
				</tbody>
			</table>
			<button class="layui-btn">保存</button>
			<button class="layui-btn">生成</button>
			</div>
		</div>
		<script src="assets/layui/layui.js" type="text/javascript"></script>
		<script src="assets/js/all.js" type="text/javascript"></script>
		<script type="text/javascript">
			layui.use(['form','layer'],function(){
				var form = layui.form,
					layer = layui.layer,
					$ = layui.$
				//自定义表单页面js	
				$("body").delegate("#form-table .del-btn", "click", function() {
					var thisBtn = $(this);
					layer.confirm('确定删除此行信息么', function(index) {
						thisBtn.parents("tr").remove();
						layer.close(index);
					});
				});
				$("body").delegate("#edit-newline", "click", function() {
					var tableLine = '<tr><td><input type="text" class="layui-input"/></td><td><input type="text" class="layui-input"/></td><td><select name="" lay-filter=""><option value="">请选择</option><option value="0">单选框</option><option value="1">文本</option><option value="2">下拉框</option></select></td><td><textarea placeholder="请输入内容" class="layui-textarea"></textarea></td><td><input type="text" class="layui-input"/></td><td><input type="text" class="layui-input"/></td><td><div class="layui-input-inline"><input type="radio" name="yes" value="是" title="是" checked=""><input type="radio" name="yes" value="否" title="否"></div></td><td><a class="layui-btn layui-btn-danger layui-btn-xs del-btn">删除</a></td></tr>';
					$("#form-table tbody").append(tableLine);
					form.render("select");
					form.render("radio");
				});
			})
		</script>
	</body>

</html>